<?php

namespace App\Http\Controllers\Coopen;

use App\Nav;
use App\Post;
use App\Service\Adseat;
use App\Setting;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class IndexController extends Controller
{
    //
    private $postManager;
    private $settingManager;
    private $request;
    public function __construct (Request $request)
    {
        $this->postManager = new Post();
        $this->settingManager = new Setting();
        $this->request = $request;
    }
    public function index(){
        $data = [
            'tzgg'  =>  $this->postManager->getPostsByCategory('tzgg',['length'=>1,'order'=>'created_at']),
            'xwdt'  =>  $this->postManager->getPostsByCategory('xwdt',['order'=>'created_at','length'=>4]),
            'banners'   =>  Adseat::getDisplay()
        ];
        return view('coopen.index',$data);
    }
}
